<template>
  <div>
    <el-form ref="form" :model="form">
      <el-form-item>
        <h3 style="text-align: left">多选题</h3>
        <el-form-item class="question"
          >{{ Mform.id }}、{{ Mform.question }}</el-form-item
        >
        <el-checkbox-group v-model="checkedAnswers" class="checkboxGroup">
          <el-checkbox label="1" name="type" disabled>{{ Mform.selectA }}</el-checkbox>
          <el-checkbox label="2" name="type" disabled>{{ Mform.selectB }}</el-checkbox>
          <el-checkbox label="3" name="type" disabled>{{ Mform.selectC }}</el-checkbox>
          <el-checkbox label="4" name="type" disabled>{{ Mform.selectD }}</el-checkbox>
        </el-checkbox-group>
        <div class="MultiSelectAnswer">
          <el-form-item label="本题分数："></el-form-item>
          <el-form-item label="正确答案："></el-form-item>
          <el-form-item label="解析："></el-form-item>
        </div>
      </el-form-item>
      <!-- <div class="BoxTime">
        <el-form-item id="time-label" label="总成绩"></el-form-item>
      </div> -->
    </el-form>
  </div>
</template>

<script>
import { mapState } from "vuex";
// const AnsOptions = ['答案1', '答案2', '答案3', '答案4']
export default {
  name: "MyMultiSelect",
  data() {
    return {
      form: {
        type: [],
      },
      checkedAnswers: ["2", "3"],
      // answers: AnsOptions
    };
  },
  props: ["id"],
  computed: {
    ...mapState({ multiList: (state) => state.smy.multiList }),
    Mform() {
      return this.multiList[this.id - 1];
    },
  },
  watch: {
    // 监听id 改变时 路由跳转将选中项置空
    // id() {
    //   console.log(this.id);
    //   this.checkedAnswers = [];
    // },
  },
};
</script>

<style lang="scss" scoped>
.checkboxGroup {
  display: flex;
  /* justify-content: space-between; */
  align-items: flex-start;
  /* 转换主轴方向 */
  flex-direction: column;
  /* 字符间距 */
  /* letter-spacing: 5px; */
}
::v-deep {
  .el-checkbox {
    display: inline-block;
    padding-left: 38px;
    /* 文本缩进 */
    // text-indent: 20px;
    // line-height: 3;
    //鼠标滑过改变字体和小圆圈边框的样式
    &:hover {
      border-color: #25a785 !important;
      color: #25a785 !important;
      //鼠标滑过时小圆点边框显示
      .el-checkbox__inner {
        border-color: #25a785;
      }
    }
    .el-checkbox__input {
      margin-bottom: px(5);
      //选中时的样式
      &.is-checked {
        .el-checkbox__inner {
          //选中时小圆圈的的颜色
          background-color: #25a785;
          border-color: #25a785;
          // border-radius: 25px;
        }
        + .el-checkbox__label {
          //选中时字体的颜色
          color: #25a785 !important;
        }
      }
      .el-checkbox__inner {
        // 鼠标滑过小圆点时的样式
        &:hover {
          border-color: #25a785;
        }
      }
    }
  }
  .el-form {
    #time-label .el-form-item__label {
      font-size: 40px;
    }
  }
}
.BoxTime {
  position: absolute;
  top: 140px;
  right: 80px;
  height: 100px;
  width: 200px;
  // background-color: pink;
}
.question {
  display: flex;
  // font-size: 20px;
}
</style>
